package com.atguigu.crud.service;

import com.atguigu.crud.bean.Department;
import com.atguigu.crud.dao.DepartmentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DepartmentService {

	@Autowired
	private DepartmentMapper departmentMapper;

//	private TestSetterInject testSetterInject;

	public DepartmentService() {
		System.out.println("DepartmentService()");
	}
	
	public List<Department> getDepts() {
		List<Department> depts = departmentMapper.selectByExample(null);
		return depts;
	}

	// 并不会自动注入，bean能自动注入属性是有要求的，要求bean定义是按类型或名称自动注入的，而一般的是不自动注入
//	public void setTestSetterInject(TestSetterInject testSetterInject) {
//		this.testSetterInject = testSetterInject;
//	}
}
